package com.deepnaming.api.view

import BotModel
import com.github.kotlintelegrambot.entities.ChatId
import dto.MessageFromAssistant
import io.ktor.http.HttpStatusCode
import io.ktor.server.application.Application
import io.ktor.server.application.call
import io.ktor.server.request.receive
import io.ktor.server.response.respond
import io.ktor.server.routing.get
import io.ktor.server.routing.post
import io.ktor.server.routing.routing
import org.slf4j.Logger

fun Application.configureRouting(
    botModelImpl: BotModel,
) {
    routing {
        post("/message") {
            val messageFromAssistant = call.receive<MessageFromAssistant>()
            println(messageFromAssistant)
            botModelImpl.sendTextMessage(messageFromAssistant.tgId.toLong(), messageFromAssistant.message)
            call.respond(HttpStatusCode.OK)

        }
    }
}
